package com.daoliuhe.scaffold.tools;


import org.jasypt.util.text.BasicTextEncryptor;

/**
 * 加密工具
 */
public class EncryptUtil {
    static BasicTextEncryptor textEncryptor = new BasicTextEncryptor();

    static {
        textEncryptor.setPassword("daoliuhe@#");
    }

    /**
     * 对文本加密
     *
     * @param text
     * @return
     */
    public static String encode(String text) {
        return textEncryptor.encrypt(text);
    }

    /**
     * 对文本解密
     *
     * @param text
     * @return
     */
    public static String decode(String text) {
        String ret = null;
        try {
            ret = textEncryptor.decrypt(text);
        } catch (Exception e) {

        }
        return ret;
    }

}
